"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolBoxUnit = void 0;
// import imgUrl from "../assets/images/fullscreen.png";
var templateLeftHtml = "\n<div class=\"tool-box-left-container\">\n    <span class='icon-button icon-button-fullscreen' title='fullscreen'></span>\n</div>";
var templateRightHtml = "\n<div class=\"tool-box-right-container\">\n    <span class='select-item' mode='day'>Day</span>\n    <span class='select-item' mode='week'>Week</span>\n    <span class='select-item' mode='month'>Month</span>\n</div>\n";
var ToolBoxUnit = /** @class */ (function () {
    function ToolBoxUnit(myChart, $canvasContainer, config, dom) {
        this.myChart = myChart;
        this.$canvasContainer = $canvasContainer;
        this.config = config;
        this.dom = dom;
        this.$toolboxLeft = $('');
        this.$toolboxRight = $('');
        this.dayClickEvents = [];
        this.weekClickEvents = [];
        this.monthClickEvents = [];
        if (config.showTimeViewMode) {
            this.$toolboxRight = $(templateRightHtml);
            this.$canvasContainer.append(this.$toolboxRight);
        }
        if (config.showImageToolbox) {
            this.$toolboxLeft = $(templateLeftHtml);
            this.$canvasContainer.append(this.$toolboxLeft);
        }
        this.init();
    }
    ToolBoxUnit.prototype.init = function () {
        var _this = this;
        this.$toolboxRight.on('click', '.select-item', function (e) {
            var $cur = $(e.target);
            var curModel = $cur.attr('mode');
            _this.selectMode(curModel);
        });
        this.$toolboxLeft.on('click', '.icon-button-fullscreen', function () {
            $(_this.dom).toggleClass('full-screen');
            // this.myChart.resize();
            return false;
        });
    };
    ToolBoxUnit.prototype.selectMode = function (mode) {
        var $cur = this.$toolboxRight.find("[mode=\"" + mode + "\"]");
        $cur.addClass('selected').siblings().removeClass('selected');
        switch (mode) {
            case 'day':
                this.dayClickEvents.forEach(function (item) { return item(); });
                break;
            case 'week':
                this.weekClickEvents.forEach(function (item) { return item(); });
                break;
            case 'month':
                this.monthClickEvents.forEach(function (item) { return item(); });
                break;
            default:
                break;
        }
    };
    return ToolBoxUnit;
}());
exports.ToolBoxUnit = ToolBoxUnit;
